<?php
require_once('mysql.php');

$user_id = $_GET['user_id'];

$json = array();

$query = "SELECT list.name, list.id, list.description FROM todo_list AS list WHERE list.id IN (SELECT list_id FROM can_edit WHERE user_id=$user_id)";

$result = mysql_query($query) or die(mysql_error());

while($row = mysql_fetch_assoc($result)) {
	$entry = array();
	$entry['name'] = $row['name'];
	$entry['id'] = $row['id'];
	array_push($json, $entry);
}

echo json_encode($json);

?>

